package cn.zbmao.web.controller.user;

import cn.zbmao.web.bean.User;
import cn.zbmao.web.util.dao.DaoFactory;
import com.jfinal.core.Controller;


public class AuthController extends Controller {
	
	
	public void index(){
		String key = getPara("key");
		int userId = getParaToInt("userId");
		if (DaoFactory.getUserDao().autoLoginUser(userId, key)) {
			User user = User.dao.findById(userId);
			redirect("/login/loginto?username="+user.getStr("user_name")+"&pwd="+user.getStr("user_pwd"));
		}else{
			redirect("/login");
		}
	}
}
